<template>
  <div class="common-layout">
    <el-container class="lay-container">
      <common-aside />
      <el-container>
        <common-header />
        <el-main class="right-main">
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { defineComponent } from "vue";
import CommonHeader from "../components/CommonHeader.vue";
import CommonAside from "../components/CommonAside.vue";

export default defineComponent({
  components: {
    CommonHeader,
    CommonAside,
  },
});
</script>

<style lang="less" scoped>

  .el-container {
    flex-wrap: wrap;
    align-items: flex-start;
    height: 100%;
    overflow: hidden; /* 隐藏 el-container 的滚动条 */
  }

  .common-layout {
    .lay-container {
      display: flex;
      flex-wrap: nowrap;
      height: 100vh; /* 设置 lay-container 高度为100%，以撑开 el-container */
    }

    .right-main {
      height: calc(100vh - 124px); /* 设置右侧内容高度，保留头部和底部空间 */
      overflow-y: auto; /* 只有右侧内容区域有滚动条 */
    }

    .el-container {
      height: 100%;
      position: relative; /* 保证 el-container 内容不超出视口 */
    }

    .el-aside {
      height: 100%;
      background: #545c64;
      flex: 0 0 auto; /* 固定侧边栏宽度 */
    }
  }

</style>